﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XXX.Models.MO
{
    /// <summary>
    /// 生产订单接口调用使用类，根据这个封装订单
    /// </summary>
    public class API_Morder
    {
        public int Moid { get; set; }
        public string cMoCode { get; set; }

        public List<MorderDetail> ItemList { get; set; }

        public string cMaker { get; set; }

        public string cHandler { get; set; }

        /// <summary>
        /// 生产订单子表明细
        /// </summary>
        public class MorderDetail
        {
            public int MoDid { get; set; }
            //生产订单行号
            public int SortSeq { get; set; }
            /// <summary>
            /// 生产订单类型
            /// </summary>
            public string MoClass { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cDepCode { get; set; }
            /// <summary>
            /// 生产部门
            /// </summary> 
            public string cDeptName { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cInvCode { get; set; }
            /// <summary>
            /// 
            /// </summary>
            /// 
            public int BomType { get; set; }
            public int BomId { get; set; }

            public int Partid { get; set; }
            public string WhCode { get; set; }

            /// <summary>
            /// 
            /// </summary>
            public decimal iQuantity { get; set; }
            /// <summary>
            /// 加工工单
            /// </summary>
            public string MoTypeId { get; set; }
            /// <summary>
            /// <summary>
            /// 加工工单
            /// </summary>
            public string cMoType { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public DateTime dBeginDate { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public DateTime dEndDate { get; set; }
            /// <summary>
            /// 张三
            /// </summary>
            public string cMaker { get; set; }
            /// <summary>
            /// 工序号码
            /// </summary>
            public string Define22 { get; set; }
            /// <summary>
            /// 工序名称
            /// </summary>
            public string Define23 { get; set; }
            public string cHandler { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cMemo { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cSoCode { get; set; }
            /// <summary>
            /// 销售跟踪类型
            /// </summary>
            public string SoType { get; set; }
            /// <summary>
            /// 销售订单id
            /// </summary>
            public string SoDid { get; set; }
            /// <summary>
            /// 销售订单行号
            /// </summary>
            public string SoSeq { get; set; }

            public string OrderType { get; set; }
            /// <summary>
            /// 销售跟踪类型
            /// </summary>
            public string OrderDId { get; set; }
            /// <summary>
            /// 销售订单id
            /// </summary>
            public string OrderCode { get; set; }
            /// <summary>
            /// 销售订单行号
            /// </summary>
            public string OrderSeq { get; set; }
            /// <summary>
            /// 客户编码
            /// </summary>
            public string CustCode { get; set; }
            /// <summary>
            ///表体自定义项11，
            /// </summary>
            public string Define32 { get; set; }

            /// <summary>
            /// 
            /// </summary>
            public string cParentCode { get; set; }
            /// <summary>
            /// 项目大类
            /// </summary>
            public string cItemClass { get; set; }
            /// <summary>
            /// 项目编码
            /// </summary>
            public string cItemCode { get; set; }
            /// <summary>
            /// 已入库数量，更新的时候使用
            /// </summary>
            public string QualifiedInQty { get; set; }

            public string AuxUnitCode { get; set; }
            //增加计划
            public string PlanCode { get; set; }

            public string DemandId { get; set; }
            public Decimal? AuxQty { get; set; }
            public Decimal? ChangeRate { get; set; }
         
            /// <summary>
            /// 
            /// </summary>
            public List<Material> MaterialList { get; set; }
        }

        public class Material
        {
            /// <summary>
            /// 
            /// </summary>
            public string AllocateId { get; set; }
            /// <summary>
            ///  
            /// </summary>
            public int iRowNo { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cChildCode { get; set; }

            //子件对应id
            public int Componentid { get; set; }
            /// <summary>
            /// 单位用量
            /// </summary>
            public decimal dBaseQtyN { get; set; }
            /// <summary>
            /// 总用量
            /// </summary>
            public decimal dQty { get; set; }

            public int WIPType { get; set; }
            public string opSeq { get; set; }

            public string opName { get; set; }
            /// <summary>
            /// 辅助计量单位
            /// </summary>
            public string AuxUnitCode { get; set; }

            /// <summary>
            /// 换算率
            /// </summary>
            public decimal? ChangeRate { get; set; }
            /// <summary>
            /// 辅助单位用量
            /// </summary>
            public decimal? AuxBaseQtyN { get; set; }
            /// <summary>
            /// 辅助总用量
            /// </summary>
            public decimal? AuxQty { get; set; }

            /// <summary>
            /// 已领料量，更新的时候用
            /// </summary>
            public decimal? IssQty { get; set; }

            public int? OpComponentId { get; set; }

            public string WhCode { get; set; }
        
            /// 
            /// </summary>
            public List<SubList> subList { get; set; }
        }
        public class SubList
        {
            /// <summary>
            /// 替代料存货编码
            /// </summary>
            public string cSubCode { get; set; }
            /// <summary>
            /// 替代料的partid
            /// </summary>
            public string SubPartid { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string cFactor { get; set; }
            /// <summary>
            /// 标记是否匹配，更新的时候用
            /// </summary>
            public string SubPiPei { get; set; }
        }

    }
}
